# 19704 Spring 2014
# Homework 1
# Nandi Zhang

# HW1.R
# This scripts calcultes and outputs the result of 2 + 2. It also contains some practice
# code.

# Required part
cat("2 + 2 =", 2+2)

# Practice
sample.first <- c(1,3,5,7,9)
sample.second <- c(0,2,4,6,8)
sample <- c(sample.first, sample.second)     # Use of combine function

firstThree <- sample[1:3]
largerThanThree <- sample[sample > 3]
howManyLargerThanThree <- sum(sample > 3)    # Indexing and colon operator

evenIndexed <- sample[seq(2,10,2)]           # Use of seq()

avg.Sample <- mean(sample)
std.Sample <- sd(sample)